<?php

namespace app\admin\model\broker;

use think\Model;


class Newhouse extends Model
{

    

    

    // 表名
    protected $name = 'new_house';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'sex_data_text',
        'visiting_form_data_text',
        'buy_hose_data_text',
        'donghu_data_text',
        'xihu_data_text',
        'intentional_house_type_data_text',
        'satisfaction_level_data_text',
        'garage_num_data_text',
        'purchase_cycle_data_text',
        'pay_method_data_text',
        'number_of_properties_text',
        'know_the_way_data_text',
        'create_time_text'
    ];
    

    
    public function getSexDataList()
    {
        return ['1' => __('Sex_data 1'), '2' => __('Sex_data 2')];
    }

    public function getVisitingFormDataList()
    {
        return ['1' => __('Visiting_form_data 1'), '2' => __('Visiting_form_data 2'), '3' => __('Visiting_form_data 3')];
    }

    public function getBuyHoseDataList()
    {
        return ['1' => __('Buy_hose_data 1'), '2' => __('Buy_hose_data 2'), '3' => __('Buy_hose_data 3'), '4' => __('Buy_hose_data 4'), '5' => __('Buy_hose_data 5'), '6' => __('Buy_hose_data 6'), '7' => __('Buy_hose_data 7'), '8' => __('Buy_hose_data 8')];
    }

    public function getDonghuDataList()
    {
        return ['1' => __('Donghu_data 1'), '2' => __('Donghu_data 2'), '3' => __('Donghu_data 3')];
    }

    public function getXihuDataList()
    {
        return ['1' => __('Xihu_data 1'), '2' => __('Xihu_data 2'), '3' => __('Xihu_data 3')];
    }

    public function getIntentionalHouseTypeDataList()
    {
        return ['1' => __('Intentional_house_type_data 1'), '2' => __('Intentional_house_type_data 2'), '3' => __('Intentional_house_type_data 3')];
    }

    public function getSatisfactionLevelDataList()
    {
        return ['1' => __('Satisfaction_level_data 1'), '2' => __('Satisfaction_level_data 2'), '3' => __('Satisfaction_level_data 3')];
    }

    public function getGarageNumDataList()
    {
        return ['1' => __('Garage_num_data 1'), '2' => __('Garage_num_data 2')];
    }

    public function getPurchaseCycleDataList()
    {
        return ['1' => __('Purchase_cycle_data 1'), '2' => __('Purchase_cycle_data 2'), '3' => __('Purchase_cycle_data 3'), '4' => __('Purchase_cycle_data 4')];
    }

    public function getPayMethodDataList()
    {
        return ['1' => __('Pay_method_data 1'), '2' => __('Pay_method_data 2'), '3' => __('Pay_method_data 3')];
    }

    public function getNumberOfPropertiesList()
    {
        return ['1' => __('Number_of_properties 1'), '2' => __('Number_of_properties 2')];
    }

    public function getKnowTheWayDataList()
    {
        return ['1' => __('Know_the_way_data 1'), '2' => __('Know_the_way_data 2'), '3' => __('Know_the_way_data 3'), '4' => __('Know_the_way_data 4'), '5' => __('Know_the_way_data 5'), '6' => __('Know_the_way_data 6'), '7' => __('Know_the_way_data 7'), '8' => __('Know_the_way_data 8'), '9' => __('Know_the_way_data 9'), '10' => __('Know_the_way_data 10'), '11' => __('Know_the_way_data 11')];
    }


    public function getSexDataTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['sex_data']) ? $data['sex_data'] : '');
        $list = $this->getSexDataList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getVisitingFormDataTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['visiting_form_data']) ? $data['visiting_form_data'] : '');
        $list = $this->getVisitingFormDataList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getBuyHoseDataTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['buy_hose_data']) ? $data['buy_hose_data'] : '');
        $list = $this->getBuyHoseDataList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getDonghuDataTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['donghu_data']) ? $data['donghu_data'] : '');
        $list = $this->getDonghuDataList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getXihuDataTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['xihu_data']) ? $data['xihu_data'] : '');
        $list = $this->getXihuDataList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getIntentionalHouseTypeDataTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['intentional_house_type_data']) ? $data['intentional_house_type_data'] : '');
        $list = $this->getIntentionalHouseTypeDataList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getSatisfactionLevelDataTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['satisfaction_level_data']) ? $data['satisfaction_level_data'] : '');
        $list = $this->getSatisfactionLevelDataList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getGarageNumDataTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['garage_num_data']) ? $data['garage_num_data'] : '');
        $list = $this->getGarageNumDataList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getPurchaseCycleDataTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['purchase_cycle_data']) ? $data['purchase_cycle_data'] : '');
        $list = $this->getPurchaseCycleDataList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getPayMethodDataTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['pay_method_data']) ? $data['pay_method_data'] : '');
        $list = $this->getPayMethodDataList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getNumberOfPropertiesTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['number_of_properties']) ? $data['number_of_properties'] : '');
        $list = $this->getNumberOfPropertiesList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getKnowTheWayDataTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['know_the_way_data']) ? $data['know_the_way_data'] : '');
        $list = $this->getKnowTheWayDataList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getCreateTimeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['create_time']) ? $data['create_time'] : '');
        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
    }

    protected function setCreateTimeAttr($value)
    {
        return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
    }


}
